package cn.lkk.samples.lang.inheritance.abstractClasses;

import java.util.Date;
import java.util.GregorianCalendar;

public class Employee extends Person {
    private double salary;
    private Date hireday;

    public Employee(String n, double s, int year, int month, int day) {
        super(n);
        salary = s;
        hireday = new GregorianCalendar(year, month - 1, day).getTime();
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public void setHireday(Date hireday) {
        this.hireday = hireday;
    }

    public void raiseSalary(double byPercent) {
        double raise = salary * byPercent / 100;
        salary += raise;
    }

    @Override
    public String getDescription() {
        return String.format("an employee with a salary of $%.2f", salary);
    }
}
